package itheima.com.myhashmap;

import java.util.Hashtable;

public class MyHashtableDemo1 {
    public static void main(String[] args) throws InterruptedException {
        Hashtable<String, String> hm = new Hashtable<>();

        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 25; i++) {
                hm.put(i + "", i + "");
            }
        });

        Thread t2 = new Thread(() -> {
            for (int i = 25; i < 51; i++) {
                hm.put(i + "", i + "");
            }
        });

        t1.start();
        t2.start();

        System.out.println("--------");
        //休眠一下保证线程都能执行完毕
        Thread.sleep(1000);


        for (int i = 0; i < 51; i++) {
            String value = hm.get(i + "");
            System.out.println(value);
        }
    }
}
